package com.edu.glutdataconvertserver.task;

import com.edu.glutdataconvertserver.servicce.DataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

/**
 * @author ares
 */
@Component
@Lazy(false)
public class GetData {

    private DataService dataService;

    @Autowired
    public GetData(DataService dataService) {
        this.dataService = dataService;
    }

    @Scheduled(cron = "0 50 0 * * ?")
    private void configureTasks() {
        System.err.println("执行静态定时任务时间: " + LocalDateTime.now());
        dataService.delData();
    }
}
